# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=docuum
pkgver=0.23.1
pkgrel=0
pkgdesc="Perform least recently used (LRU) eviction of Docker images"
url="https://github.com/stepchowfun/docuum"
# riscv64: rust is broken on this arch
arch="all !riscv64"
license="MIT"
makedepends="cargo cargo-auditable"
install="$pkgname.pre-install"
subpackages="$pkgname-openrc"
source="https://github.com/stepchowfun/docuum/archive/v$pkgver/docuum-$pkgver.tar.gz
	$pkgname.initd
	$pkgname.confd
	$pkgname.logrotate
	"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release
}

check() {
	# format::tests::code_str_display - broken test?
	cargo test --frozen -- \
		--skip format::tests::code_str_display
}

package() {
	install -D -m755 target/release/$pkgname -t "$pkgdir"/usr/bin/

	install -D -m755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -D -m644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
	install -D -m644 "$srcdir"/$pkgname.logrotate "$pkgdir"/etc/logrotate.d/$pkgname
}

sha512sums="
acc9e47b074bd00b4d98597eb7a218d3e9c006e85d721eb3a732042858ec383e4537db5f110fb08da7575adf80ca01969cffad4084e96b3c8f4935a0e79a748e  docuum-0.23.1.tar.gz
1bbf4baba54b4c36d44c85fa0b898e9bf10ce52ce242cc47488e8d2eb4d0ba45c6560c2ee7025811721786021ed3f4149bb7423dd1e7c07ad79c0027a5ae334d  docuum.initd
3a021f6d9fef59e4dcec56e0c91816efa7b432e4eee066888dc4dc04f08f1433b72fb48a89bbd711c96d11fde1ad5c6233b0d943ca620337c9ac955d4f95d60d  docuum.confd
63d1d053f36bb475d6775cc5806ebb44e030245a776da98724d1ac2f36247447b8d65964a8ac40d881a8c78e4224aa5f1311666e616b303a9dd879694faa0c26  docuum.logrotate
"
